require("../../assets/css/basic.less");
require("../../assets/css/normalize.css");
require("../../assets/css/property.css");
require("../../assets/css/reset.css");
require("../../assets/fonts/font-icon/iconfont.css");
require("../course_details/course_details.less");

const axios = require("../../libs/axios.js");
const dom = require("../../libs/dom.js");

document.addEventListener("DOMContentLoaded", function () {
	//1. 点击回到上一页
	dom.get("#goBack").addEventListener("click", function () {
		history.back();
	});

	//2. 获取地址栏传递的参数id
	let id = location.search.split("=").pop();

	axios.get("/api/train/courseDetail?id=" + id).then((res) => {
		console.log(res);

		//将视频数据存储到localStorage中
		let data = res.data.data.fragments;
		console.log(data);
		localStorage.setItem("fragments", JSON.stringify(data));
	});
});
